/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package services.Impl;

import java.util.Collection;
import java.util.Date;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import models.Baskets;
import models.Orders;
import models.Tables;
import models.Users;
import services.interfaces.IOrdersService;

/**
 *
 * @author amega
 */
@Stateless
@LocalBean
public class OrdersServiceImpl extends GenericServiceImpl<Orders> implements IOrdersService {

    
    @PersistenceContext(unitName="orsPU")
    private EntityManager em;
    
    public OrdersServiceImpl() {
        super(Orders.class);
    } 
    
    @Override
    protected EntityManager getEntityManager() {
       return this.em;
    }

    @Override
    public void addBasketToOrders(Orders order, Baskets basket) {
        
    }

    @Override
    public Collection<Orders> getOrdersInDate(Date date) {
        Query q = em.createNamedQuery("Orders.findByDateTime").setParameter("dateTime", date);
        Collection entities = q.getResultList();
        return  entities;
    }
    
    

    
}
